//
//  HttpTool.m
//  YuDou
//
//  Created by yingqi on 2018/6/22.
//  Copyright © 2018年 yingqi. All rights reserved.
//

#import "HttpTool.h"
#import "NSDate+Extension.h"

@implementation HttpTool

singleton_implementation(HttpTool)

// POST
- (void)postWithUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(HttpSuccessBlock)success failure:(HttpFailureBlock)failure
{
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    
    [manager POST:url parameters:parameters progress:^(NSProgress *downloadProgress) {
        
    } success:^(NSURLSessionDataTask *task, id responseObject) {
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
    }];

}

// GET
- (void)getWithUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(HttpSuccessBlock)success failure:(HttpFailureBlock)failure
{
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

    [manager GET:url parameters:parameters progress:^(NSProgress *downloadProgress) {
        
    } success:^(NSURLSessionDataTask *task, id responseObject) {
        
        if (success) {

            success(responseObject);
        }
        
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
    }];
    

}
@end
